package com.cdtu.store.item.controller;

import com.cdtu.store.common.utils.PageUtils;
import com.cdtu.store.common.utils.R;
import com.cdtu.store.common.entity.PayLogEntity;
import com.cdtu.store.item.service.PayLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;




/**
 * 
 *
 * @author dongyuhao
 * @email a1059444570@qq.com
 * @date 2020-06-22 19:53:26
 */
@RestController
@RequestMapping("store-item-service/paylog")
public class PayLogController {
    @Autowired
    private PayLogService payLogService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = payLogService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{orderId}")
    public R info(@PathVariable("orderId") Long orderId){
		PayLogEntity payLog = payLogService.getById(orderId);

        return R.ok().put("payLog", payLog);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody PayLogEntity payLog){
		payLogService.save(payLog);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody PayLogEntity payLog){
		payLogService.updateById(payLog);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] orderIds){
		payLogService.removeByIds(Arrays.asList(orderIds));

        return R.ok();
    }

}
